package online.sharin.aix;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

/**
 * 如果因包android.support.design不存在而导致 Snackbar 类不存在,可以点击"Project Structure > Modules > app > Dependencies"中添加支持库,
 * 或者在build.gradle中添加 ``` implementation 'com.android.support:design:26.1.0' ```,gradle会自动下载对应的类库并安装
 * 使用该空间需要 AppCompatActivity 和 Theme.AppCompat 的支持
 * Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
 * 继承自 AppCompatActivity 的 Activity 使用了Activity的主题
 */
public class MainActivity extends BaseActivity implements View.OnClickListener {

    Button clickMe;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        clickMe = findViewById(R.id.click_me);

        clickMe.setOnClickListener(this);

        Button goSplash = findViewById(R.id.go_splash);
        goSplash.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.click_me:
                speakOut("Argentum down to 3499");
                break;
            case R.id.go_splash:
                Intent intent = new Intent();
                intent.setClass(this, SplashActivity.class);
                startActivity(intent);
                break;
        }
    }

}
